package com.zito.health.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zito.health.common.annotations.ResponseResult;
import com.zito.health.common.result.PageResult;
import com.zito.health.common.result.VerifyResult;
import com.zito.health.dto.LaboratoryDto;
import com.zito.health.dto.LaboratoryLinkmanDto;
import com.zito.health.dto.LaboratoryPrint1Dto;
import com.zito.health.dto.LaboratoryPrint2Dto;
import com.zito.health.entity.*;
import com.zito.health.service.LaboratoryCredentialsService;
import com.zito.health.service.LaboratoryLinkmanService;
import com.zito.health.service.LaboratoryService;
import com.zito.health.util.CacheUtil;
import com.zito.health.vo.LabCoordinateVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Date;
import java.util.List;

/**
 * @description: 实验室证件(证书)
 * @author: zxs
 * @time: 2020/5/27 15:31
 */
@Slf4j
@ResponseResult
@RestController
@RequestMapping("/laboratoryCredentials")
public class LaboratoryCredentialsController {

    @Autowired
    private LaboratoryCredentialsService laboratoryCredentialsService;

    /**
     *修改
     * @param laboratoryCredentials
     * @return
     */
    @PutMapping
    public VerifyResult update(LaboratoryCredentials laboratoryCredentials){
        VerifyResult verifyResult = new VerifyResult();
        laboratoryCredentialsService.update(laboratoryCredentials);
        return verifyResult;
    }

    /**
     *
     * @param laboratoryId
     * @return
     */
    @GetMapping("/queryByLaboratoryId")
    public LaboratoryCredentials queryByLaboratoryId(Integer laboratoryId){
        LaboratoryCredentials param = new LaboratoryCredentials();
        param.setLaboratoryId(laboratoryId);
        LaboratoryCredentials laboratoryCredentials = laboratoryCredentialsService.queryOne(param);
        return laboratoryCredentials;
    }

    /**
     *证书有效期修改
     * @auth sun
     * @return
     */
    @GetMapping("/updateCertificateByLabId")
    public VerifyResult updateCertificateByLabId(LaboratoryCredentials laboratoryCredentials){
        VerifyResult verifyResult = new VerifyResult();
        laboratoryCredentialsService.updateCertificateByLabId(laboratoryCredentials);
        return verifyResult;
    }

}
